﻿package com.paipai.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static final String app_id = "2016101200666615";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static final String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCDprN/Z3J8FA0jO/BNyDh2GyJZ+TSK97Cn2apvtqvuMBv9hC2gCFuj1FRmzrNGFhBuDekgvCey4JCcK4fmVs3lWp4ckFGB4+ZOEloL3UETUgeK6wARcsq7R3dhz6wUv/Ir7JT44H0GwjyRbfybbgr5TKGBf8ZCN/GxHub0iCjP+cI2Fp+e60RRCEH17DXjMCVv2l+fSpGXFRQuTLfo3Y8BAowLY/aUtOqWyyCSU56wOvAoZDjCMgWCuFIWMNT+fMQDtUm85evGojGS8B5Z2W5g3TlxxxUfX7JtOX7BmR4N04MuwjjdXkuRl3XGy7gJyMca0MRShLMFURHinKpj4Jz5AgMBAAECggEAJvynC4PHE5ecjGKjt2Uj01YVxi9WsBDJ7+s13f9qyw7UOy95k3rmKI4osIll7ct68hyMfXU7DG4UZSs/A6eRMeq0CCF1AdJL0bL9l6XeL6qLMUiGrKQiBXQUlpK5kyuEvB1DwLA6VlYPOcIonJ7qAQoAiikcvV9z49AS9TedXnlbmF1RPuBBMWDMK3g0bYIAw53r0JGe9W57PdlXqqUC3ASBSGRAjIKemiXHS3mLFpXCpMY0IyGIIEuALGxgOysPWzmT9xv6G8GUUWSlSaXB+qBqeZiV/viJfChs9+OHYxdENrpe9rXyGl04Z9yOPcNCho+OPA3yCYZlxBZZDcpFAQKBgQC7fAPc7eJlQ5htY5/igIEvwcmihr0pgURbE/Go3snO/lGLR39ShQ2DS+dpady5j7qw3thgpRyFdGJJheh0vI9JI6N9YNS7QpMxvK02RacVTIPh54i+rN0Rlk4jvK83aZMNDPB8rtW+ZHMlINxOu1TGDZA5ffm47/4osFLNyuJqtQKBgQCzwz3l/JHXAtu1LLoSTsKcHzQzuWdsop4QGkuUXlQm/OVg1SA/zcP1lLK7yNleDiDxe6ij3KPO9qalsGhJyXtgM1CzcnBbC5uOQSTZiga4C6obDGtLy5dpD6pxmNne9OO3KTl+wLll6uHMdzp2rWeMbJ4vFSxz+EyWv/PK0KpftQKBgCXEe7q7qQmhLkmK8iBcpqmKLiYxYlXEFpMKV3ofNyQdkyutgXaMGwbB+aIAk1hGHeOXYJtHZ5FyuoH5GbS6b1radQrCwNfgN2qjiXkPWvMtcLvHOoK+q+HpF2CXl+xftiHA44kaZzBtZ8yo6/hoQFGNVepe+DlLDzX/Hw8ZubapAoGAJdJ1ipdKpB+Q1JzVhZaWsbyLAjsHPL82XJL7xfrW3+Ej7ezJvULw8RHZTVNkELsOSWDISbnZqWkSBRiJyMSgtcv2NdtlMnLNxu+D7lVxNnYV010YkjkC4XMPXJlZdeS2qMn+s+Ge4Ie7/IY1gdTYTZ5o5eUhlkDu9GTsyYZ/4mUCgYEAhHCehVYa27QHUeJKI/GALGmZiksoLWNZ9FGTihiRY8LIuFFOENhi0uPhnNMyvmOuCr1mD/MVTocXQwj3ZEFFr4Ps4lc78ihy932hnVr8OhXibJMuSiH9MyM3SwTwajS+YKXH2lM/UdFhQ65vqCBlH981yt84HS799V+si2V3BHY=";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static final String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx9TjDKfwOru/II34UwFRadkf8W2t/nTH3AcR7LSwBVMLg5R61bdHozCBx17xs6cJNpCjFr8LKcJE1eymttUBcz4J5PDTX4F+pP1IaBWDC9G4YTUWMRvyVwUjuZPhfDvpX61X6UXvqvrjK1iplPdfEYHF2EKiIXfJmyOlNnh9TPEHg8JYjjCMBBmLdJjBKrGIwwmt1lGOKAVuxMdA9+IT9WFHj3U0c/wfuPFHIUhR9dJPNSRxDRL1Lg5xXhSe2dwaiuyH36LvplBng/9Kx/qqNPp5hI9j51w2Yl2EuYgAPSE4fsN4nYvCuH3on/okixBQg/Unt6rOaxDVO5ZspKay6wIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static final String notify_url = "http://2o8604q831.zicp.vip//notifyUrl";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static final String return_url = "http://api.paipai.com/api/order/returnUrl";

	// 签名方式
	public static final String sign_type = "RSA2";
	
	// 字符编码格式
	public static final String charset = "utf-8";
	
	// 支付宝网关
	public static final String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static final String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

